STEP 12: We have a problem! Our while loop doesn't stop. We should end it if the user enters the correct password.

The break keyword stops a loop while it's still running. We can use it inside a while loop or for loop.

  • In , drag if inside ask_for_password() and the while loop. It should be indented 8 spaces.
  • Then change the variable to the left of == from choice to response and "yes" to password.
  • In , drag Break inside your if statement. It should be indented 12 spaces.

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)